package aladyn.xmlparser;

import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;

import org.xml.sax.*;
import org.xml.sax.helpers.*;

/**
 * 
 * @author YiHan WANG, Qi XU, Bo CAI
 *
 */
public class LRSerializableXmlParser {
	
	public static ArrayList<String> parse(Reader input) throws SAXException, IOException{
		
		XMLReader xr = XMLReaderFactory.createXMLReader();
		LRSerializableXmlHandler handler = new LRSerializableXmlHandler();
		handler.setVerbose(verbose);	// mode verbose
		xr.setContentHandler(handler);
		xr.setErrorHandler(handler);
		xr.parse(new InputSource(input));
		return handler.getClasses();

	}
	
	
	//**********************************************************************//
	//*                           Option Verbose                           *//
	//**********************************************************************//
	
	protected static boolean verbose = true;
	
	public static boolean getVerbose(){
		return verbose;
	}
	
	public static void setVerbose(boolean v){
		verbose = v;
	}

}
